package com.laoye.Exception;

import com.laoye.Exception.exception.BaseException;
import com.laoye.util.Result;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class GlobalExceptionHandler {

    @ExceptionHandler(BaseException.class)
    public Result<String> baseException(BaseException e) {
        return Result.error(e.getCode(),e.getMessage());
    }
}
